package com.ivo.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ivo.model.Model;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true)
@Table (name = "PDM_D_AUTH_ROLE")
public class RoleAuthority extends Model {

	private static final long serialVersionUID = -8829683331548728199L;
	
	private Long authRoleId;
	private Category category;
	private Role role;
	private AuthorityType authority;
		
	public RoleAuthority(){}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "AUTH_ROLE_ID")
	public Long getAuthRoleId() {
		return authRoleId;
	}

	public void setAuthRoleId(Long authRoleId) {
		this.authRoleId = authRoleId;
	}
	
	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "CATE_FK")
	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}
	
	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "ROLE_FK")
	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	@ManyToOne(cascade = {CascadeType.MERGE})
	@JoinColumn(name = "AUTH_TYPE_FK")
	public AuthorityType getAuthority() {
		return authority;
	}

	public void setAuthority(AuthorityType authority) {
		this.authority = authority;
	}
	
}
